package cn.itlaobing.eshop.web.servlet;

import cn.itlaobing.eshop.web.annotation.RequestMapping;
import cn.itlaobing.eshop.web.dao.DtoDao;
import cn.itlaobing.eshop.web.dao.FocussDao;
import cn.itlaobing.eshop.web.entity.DetailEntity;
import cn.itlaobing.eshop.web.entity.DtoEntity;
import cn.itlaobing.eshop.web.entity.FoucssEntity;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;


/**
 * Created by IT-XuGeek on 2017/11/14.
 */
@WebServlet("/goods/*")
public class DtoServlet extends BaseServlet {
    @RequestMapping("/show")
    public void show(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException {
        DtoDao dtoDao = new DtoDao();
        FocussDao focussDao=new FocussDao();
        List<DetailEntity> goodDetail=dtoDao.goodsDetail();
        request.setAttribute("goodDetail",goodDetail);
        List<FoucssEntity> photo=focussDao.photo();
        request.setAttribute("photo",photo);
        List<DtoEntity> goodsList=dtoDao.qurrygoods();
        request.setAttribute("goodsList",goodsList);
        List<DtoEntity> pich=dtoDao.qurryByGoodsIsNew();
        request.setAttribute("pich",pich);
        request.getRequestDispatcher("/WEB-INF/views/index.jsp").forward(request,response);

    }

}
